package kr.saeildamil.androidstudy.ch09;

import kr.saeildamil.androidstudy.R;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;

public class ChangeMenu extends Activity {
	boolean mBiginer = true;
	private static final String tag = "LogTest";

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.changemenu);
		Log.v(tag, "onCreate");
	}

	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		Log.v(tag, "onCreateOptionMenu");
		MenuInflater mi = getMenuInflater();
		if (mBiginer) {
			Log.v(tag, "mBiginer " + mBiginer + "초보자모드");
			mi.inflate(R.menu.biginer, menu);
		} else {
			Log.v(tag, "mBiginer " + mBiginer + "전문가모드");
			mi.inflate(R.menu.professional, menu);
		}
		return true;
	}

	public void mOnClick(View v) {
		Log.v(tag, "mOnClick");
		if (v.getId() == R.id.ch09_changemenu_biginer) {
			this.mBiginer = true;
			invalidateOptionsMenu();
		} else {
			this.mBiginer = false;
			invalidateOptionsMenu();
		}
	}
}
